<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<head>
    <title>食堂点餐系统 | 控制面板</title>
    <jsp:include page="../includes/header.jsp"/>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">

    <jsp:include page="../includes/nav.jsp"/>

    <jsp:include page="../includes/menu2.jsp"/>

    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1>添加用户</h1>
                    </div>
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-right">
                            <li class="breadcrumb-item"><a href="/main">主页</a></li>
                            <li class="breadcrumb-item active">用户管理</li>
                            <li class="breadcrumb-item active">添加管理员</li>
                        </ol>
                    </div>
                </div>
            </div><!-- /.container-fluid -->
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <!-- left column -->
                    <div class="col-md-12">
                        <c:if test="${baseResult != null}">
                            <div class="alert alert-${baseResult.status == 200 ? "success" : "danger"} alert-dismissible">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                    ${baseResult.message}
                            </div>
                        </c:if>
                        <!-- jquery validation -->
                        <div class="card card-primary">
                            <div class="card-header">
                                <h3 class="card-title">${tbUser.id == null ? "新增" : "编辑 "}用户</h3>
                            </div>
                            <!-- /.card-header -->
                            <!-- form start -->
                            <form:form id="inputForm" action="/user/save" method="post" modelAttribute="tbUser">
                                <form:hidden path="id" />
                                <div class="card-body">
                                    <div class="form-group">
                                        <label for="email">邮箱</label>
                                        <form:input cssClass="form-control required email" path="email" placeholder="请输入邮箱地址"/>
                                    </div>
                                    <div class="form-group">
                                        <label for="password">密码</label>
                                        <form:password cssClass="form-control required" path="password" placeholder="请输入密码"/>
                                    </div>
                                    <div class="form-group">
                                        <label for="username">姓名</label>
                                        <form:input cssClass="form-control required" path="username" placeholder="请输入您的姓名"/>
                                    </div>
                                    <div class="form-group">
                                        <label for="phone">手机号</label>
                                        <form:input cssClass="form-control required mobile" path="phone" placeholder="请输入手机号"/>
                                    </div>
                                </div>
                                <!-- /.card-body -->
                                <div class="card-footer">
                                    <button type="submit" class="btn btn-default"  onclick="history.go(-1);">返回</button>
                                    <button type="submit" class="btn btn-info -right">提交</button>
                                </div>
                            </form:form>
                        </div>
                        <!-- /.card -->
                    </div>
            </div><!-- /.container-fluid -->
        </section>
        <!-- /.content -->
    </div>
    <jsp:include page="../includes/copyright.jsp"/>

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
        <!-- Control sidebar content goes here -->
    </aside>
    <!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<jsp:include page="../includes/footer.jsp"/>
</body>
</html>
